#!/bin/bash
#SBATCH -o cloning.out
#SBATCH -o cloning.err
#SBATCH -p huce_intel
#SBATCH -n 1
#SBATCH --mem 40000
#SBATCH -t 1000

for i in $(seq 1 38); do
iprint=$(printf '%02d' $i)
if [ ! -d ~/holylfs04/cesm_output/ctlnudge$iprint/atm ]; then
CASEROOT=~/cesm_caseroot/ens/ctlnudge$iprint
~pchan/spcam2_0-cesm1_1_1/scripts/create_clone -case $CASEROOT -clone ~/cesm_caseroot/dingbuild/ || exit -1
cp -a $0 $CASEROOT/
mkdir ~/holylfs04/cesm_output/ctlnudge$iprint
mkdir ~/holylfs04/cesm_output/ctlnudge$iprint/bld
mkdir ~/holylfs04/cesm_output/ctlnudge$iprint/run
cp ~/dingbuild/bld/cesm.exe ~/holylfs04/cesm_output/ctlnudge$iprint/bld/
for j in $(seq 0 7); do
cp ~/forcing_txt/wide/T_drft.txt ~/holylfs04/cesm_output/ctlnudge$iprint/run/T_drft$j.txt
cp ~/forcing_txt/wide/U_drft.txt ~/holylfs04/cesm_output/ctlnudge$iprint/run/U_drft$j.txt
cp ~/forcing_txt/wide/V_drft.txt ~/holylfs04/cesm_output/ctlnudge$iprint/run/V_drft$j.txt
cp ~/forcing_txt/wide/Q_drft.txt ~/holylfs04/cesm_output/ctlnudge$iprint/run/Q_drft$j.txt
cp ~/forcing_txt/wide/Z_drft.txt ~/holylfs04/cesm_output/ctlnudge$iprint/run/Z_drft$j.txt
done
fi
done



























































